package com.ruoyi.system.domain;

import lombok.*;
import com.ruoyi.common.core.domain.BaseEntity;


/**
 * 小程序用户对象 wechat_user
 *
 * @author ruoyi
 * @date 2023-04-16
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@ToString
public class WechatUser extends BaseEntity {
    private static final long serialVersionUID = 1L;


    /** session_key */
    private String session_key;

    /**手机号码*/
    private String mobile;

    private Long deptId;

    /**主键*/
    private Long id;

    /**token*/
    private String token;

    /**用户昵称*/
    private String nickname;

    /**用户头像*/
    private String avatarUrl;

    /**性别*/
    private Long gender;

    /** 所在国家*/
    private String country;

    /**省份*/
    private String province;

    /**城市*/
    private String city;

    /**小程序openId*/
    private String openId;

    /**小程序unionId*/
    private String unionId;

    /**预留字段1*/
    private String reservedOne;

    /**预留字段2*/
    private String reservedTwo;

    /**上岗证编号*/
    private String postsNumber;


    public WechatUser setWechatData(WechatData rawData,Long deptId) {
        if (rawData != null){
            this.setNickname(rawData.getNickName());
            this.setPostsNumber(rawData.getPostsNumber());
            this.setAvatarUrl(rawData.getAvatarUrl());
            this.setGender(rawData.getGender());
            this.setCity(rawData.getCity());
            this.setCountry(rawData.getCountry());
            this.setProvince(rawData.getProvince());
            this.setProvince(rawData.getProvince());
        }
        this.setDeptId(deptId);
        return this;
    }
}
